package com.cjm.one.model.order.dto;

import jakarta.validation.constraints.*;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class OrderItemDTO {

    @NotNull(message = "SKU ID不能为空")
    private Long skuId;

    @NotBlank(message = "SKU编码不能为空")
    @Size(min = 6, max = 40, message = "SKU编码长度异常")
    private String skuCode;

    @NotNull(message = "商品ID不能为空")
    private Long goodsId;

    @NotBlank(message = "SKU名称不能为空")
    @Size(max = 255, message = "SKU名称过长")
    private String skuName;

    @NotBlank(message = "缩略图不能为空")
    @Pattern(regexp = "^(http|https)://.*", message = "图片地址格式错误")
    private String thumbImg;

    @NotNull(message = "销售价不能为空")
    @Digits(integer = 10, fraction = 2, message = "价格格式错误")
    @DecimalMin(value = "0.01", message = "价格不能小于0.01")
    private BigDecimal skuPrice;

    @Digits(integer = 10, fraction = 2, message = "市场价格式错误")
    @DecimalMin(value = "0.00", message = "市场价不能为负数")
    private BigDecimal skuMarketPrice;

    @NotNull(message = "商品数量不能为空")
    @Min(value = 1, message = "商品数量至少为1")
    @Max(value = 999, message = "单商品数量超过上限")
    private Integer skuNum;
}